
/**
 * @Author: 陈瑞鹏
 * @Date:   2022-10-20 09:23:07
 * @Last Modified by:   陈瑞鹏
 * @Last Modified time: 2022-10-20 09:26:39
 */
import Sign from "../models/sign/sign.model";
import utils from "../utils/utils";

export default class sign {

  /**
   * 签到初始化
   */
  static async signInit(roleId) {
    let signData: any = await utils.get_all_json('sign/sign.json');

    for (const iterator of signData) {
      let SignRes: any = await Sign.findOne({ roleId, id: iterator.id });
      if (!SignRes) {
        let info = {
          roleId,
          id: iterator.id,
          day: iterator.day,
          week: iterator.week,
          isReceive: false,
        }
        await Sign.create(info);
      }
    }
  }
}